package com.zfei.gfb.bean;

/**
 * @author fgh
 */
public class StatusException extends RuntimeException {

    private int statusCode;

    private String reasonPhrase;

    public StatusException() {
    }

    public StatusException(String message) {
        super(message);
    }

    public StatusException(String message, Throwable cause) {
        super(message, cause);
    }

    public StatusException(Throwable cause) {
        super(cause);
    }

    public StatusException(int statusCode, String reasonPhrase) {
        super(statusCode + " " + reasonPhrase);
        this.statusCode = statusCode;
        this.reasonPhrase = reasonPhrase;
    }

    public StatusException(int statusCode, String reasonPhrase, Throwable cause) {
        super(statusCode + " " + reasonPhrase, cause);
        this.statusCode = statusCode;
        this.reasonPhrase = reasonPhrase;
    }

    public StatusException(Status status) {
        this(status.value(), status.getReasonPhrase());
    }

    public StatusException(Status status, String reasonPhrase) {
        this(status.value(), reasonPhrase);
    }

    public StatusException(Status status, Throwable cause) {
        this(status.value(), status.getReasonPhrase(), cause);
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getReasonPhrase() {
        return reasonPhrase;
    }

    public void setReasonPhrase(String reasonPhrase) {
        this.reasonPhrase = reasonPhrase;
    }
}
